using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMClientes
    {
        public BMClientes(string coneccion) 
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        private Clientes oCliente = new Clientes();
        private List<Clientes> listClientes = new List<Clientes>();
        private DAClientes daClientes = new DAClientes();

        #region BMClientesSearch
        public List<Clientes> BMClientesSearch(Clientes cliente)
        {
            try
            {
                listClientes = daClientes.DAClientesSearch(connection, cliente);
                return listClientes;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMProveedorInsert
        public Clientes BMClientesInsert(Clientes cliente)
        {
            try
            {
                cliente = daClientes.DAClientesInsert(connection, cliente);
                return cliente;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMClientesUpdate
        public void BMClientesUpdate(Clientes cliente)
        {
            try
            {
                daClientes.DAClientesUpdate(connection, cliente);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMClientesUpdateSaldo
        public void BMClientesUpdateSaldo(Clientes cliente)
        {
            try
            {
                daClientes.DAClientesUpdateSaldo(connection, cliente);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region BMClientesGetOne
        public Clientes BMClientesGetOne(Clientes cliente)
        {
            try
            {
                oCliente = daClientes.DAClientesGetOne(connection, cliente);
                return oCliente;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion
    }
}
